#define D2D_INPUT_COUNT 1
//设置指定纹理的采样模式为复杂
#define D2D_INPUT1_COMPLEX 
//指示着色器函数调用使用场景位置值的帮助器方法
#define D2D_REQUIRES_SCENE_POSITION
//hlsl帮助程序库
#include "d2d1effecthelpers.hlsli"

float radius;
float fade;
float len = 62;
float2 pos;
float amount = 0.1;
D2D_PS_ENTRY(main){

   //获取当前像素在屏幕上的位置 (绝对位置)
float2 cp = D2DGetScenePosition().xy;
float dist = distance(pos, cp);
         //获取当前像素
float4 color = D2DGetInput(0);
float4 colSum = color;

    if(dist>radius){
float2 normal = normalize(pos - cp);
float f = radius + radius * fade;
float s = smoothstep(radius, f, dist);
       [unroll(62)]
        for(
float i = 1;i<
len; i++){
float2 usePos = normal * (i * amount * s);
             //按绝对位置进行偏移采样
          colSum += D2DSampleInputAtOffset(0,usePos).
rgba;
        }
float4 col = colSum / len;
        col.a =color.
a;
        return
col;
    }

     //获取当前像素
   return
color;
}
